package edu.zut.cs.software.perfect.attendance.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import edu.zut.cs.software.perfect.base.domain.BaseTreeEntity;

/**
 * 
 * @Title: AttendanceClerk
 * @Description: TODO
 * @author: lipengde
 * @date 2020年5月30日 下午4:08:19
 */
@Entity
@Table(name = "T_ATTENDANCECLERK")
@NamedQueries({
		@NamedQuery(name = "AttendanceClerk.getRoot", query = "select m from AttendanceClerk m where m.parent is null") })
public class AttendanceClerk extends BaseTreeEntity<AttendanceClerk, Long> {

	/**
	 * @fieldName: serialVersionUID
	 * @fieldType: long
	 * @Description: TODO
	 */
	private static final long serialVersionUID = 8942958428189259320L;

	/**
	 * Attendance course Code(Id)
	 */
	@Column
	String courseCode;

	/**
	 * Attendance course Name
	 */
	@Column
	String courseName;
	
	/**
	 * The teacher in class
	 */
	@Column
	String teacherName;

	/**
	 * One AttendanceClerk relate to many CourseAttendance
	 */
	@OneToMany(mappedBy = "attendanceClerk", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	List<CourseAttendance> CourseAttendance;

	public String getCourseCode() {
		return courseCode;
	}

	public void setCourseCode(String courseCode) {
		this.courseCode = courseCode;
	}

	public String getCourseName() {
		return courseName;
	}

	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}

	public String getTeacherName() {
		return teacherName;
	}

	public void setTeacherName(String teacherName) {
		this.teacherName = teacherName;
	}

	public List<CourseAttendance> getCourseAttendance() {
		return CourseAttendance;
	}

	public void setCourseAttendance(List<CourseAttendance> courseAttendance) {
		CourseAttendance = courseAttendance;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public boolean equals(Object obj) {
		return EqualsBuilder.reflectionEquals(this, obj);
	}

	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
	}

}
